package kg.aibek.projecteuler.p10;

import java.util.Arrays;

public class Problem15 {
	int d = 20;
	long[][] m = new long[d + 1][d + 1];

	public void solve() {
		for (int i = 0; i < m.length; i++) {
			Arrays.fill(m[i], -1);
		}
		m[0][0] = 1;

		System.out.println(count(d, d));
	}

	private long count(int x, int y) {
		if (x < 0 || y < 0)
			return 0;

		if (m[x][y] == -1) {
			long c = 0;
			c += count(x - 1, y);
			c += count(x, y - 1);
			m[x][y] = c;
		}

		return m[x][y];
	}

	public static void main(String[] args) {
		Problem15 p = new Problem15();
		p.solve();
	}
}
